﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using EnumsNET;
namespace MergeExcel.Models {
    public class MergeConfigModel {
        public int TableAKeywordIndex { get; set; }
        public int TableBKeywordIndex { get; set; }
        public E_Operator FindType { get; set; }
        public int ResultType { get; set; }
        public string AppendIndexString { get; set; }

        public int[] AppendIndexList {
            get {
                if (string.IsNullOrEmpty(AppendIndexString?.Trim()))
                    return null;
                else
                {
                    string[] split = AppendIndexString.Trim().Split(',');
                    if (split.Length < 1)
                        return null;
                    else
                    {
                        int[] result = new int[split.Length];
                        for (int i = 0; i < split.Length; i++)
                        {
                            result[i] = Convert.ToInt32(split[i]);
                        }
                        return result;
                    }
                }
            }
        }

        public string TableAOverwriteIndexString { get; set; }

        public int[] TableAOverWriteIndexList {
            get {
                if (string.IsNullOrEmpty(TableAOverwriteIndexString?.Trim()))
                    return null;
                else
                {
                    string[] split = TableAOverwriteIndexString.Trim().Split(',');
                    if (split.Length < 1)
                        return null;
                    else
                    {
                        int[] result = new int[split.Length];
                        for (int i = 0; i < split.Length; i++)
                        {
                            result[i] = Convert.ToInt32(split[i]);
                        }
                        return result;
                    }
                }
            }
        }

        public string TableBOverwriteIndexString { get; set; }

        public int[] TableBOverwriteIndexList {
            get {
                if (string.IsNullOrEmpty(TableBOverwriteIndexString?.Trim()))
                    return null;
                else
                {
                    string[] split = TableBOverwriteIndexString.Trim().Split(',');
                    if (split.Length < 1)
                        return null;
                    else
                    {
                        int[] result = new int[split.Length];
                        for (int i = 0; i < split.Length; i++)
                        {
                            result[i] = Convert.ToInt32(split[i]);
                        }
                        return result;
                    }
                }
            }
        }
    }
}